<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="zhcms.admin.*" %> 
<%@ page import="zhcms.framework.*" %> 
<%@ page import="zhcms.tool.*" %> 
<jsp:useBean id="fileBean" scope="page" class="zhcms.tool.UploadBean" />
<%
request.setCharacterEncoding("utf-8");
String action=request.getParameter("atcion");
GyUserLoginValidate gycheck=new GyUserLoginValidate();
int ischeck=gycheck.UserLoginValidate(request, response);
if(ischeck==0)
{
		try{
		out.println("<script language='javascript'>alert('对不起！，您还没有登陆');location.href=\"index.jsp\";</script>");
		}
		catch(Exception e){
			e.printStackTrace();
		}
}

if(action==null || action.length()<=0  || action.equals("main"))
{
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<table border="0">
    <form name="upload" id="upload" ENCTYPE="multipart/form-data" method="post" action="?atcion=save">
    <input type="file" id="userfile" name="userfile"><input type="hidden" name="fname">
     <input name="upload" value="上传" type="submit" name="Submit"> <input name="reset" value="重置" type="reset" name="cancelit">
   </form>
</table>
</body>
</html>
<%
}
else if(action.equals("save"))
{
String TureObjectPath="/data/java/gyHuangye/WebRoot/upload/";
String VirtualObjectPath="/upload/";
fileBean.setObjectPath(TureObjectPath);
fileBean.setSize(10000*1024);
fileBean.setSuffix(".gif.jpg.png.jpge.html.htm.rar.zip");
fileBean.setSourceFile(request);
String [] saSourceFile = fileBean.getSourceFile();
String [] saObjectFile = fileBean.getObjectFileName();
String [] saDescription = fileBean.getDescription();
int iCount = fileBean.getCount();
String sObjectPath = fileBean.getObjectPath();
//out.println("<br>源始文件:");
//out.println(saSourceFile[0]);
//out.println("<br>目标文件:");
//out.println(sObjectPath+saObjectFile[0]);
//out.println("<br>上传说明:");
//out.println(saDescription[0]);
out.println("<script>parent.document.a1.ImgPath.value='" + VirtualObjectPath + saObjectFile[0] + "'</script>");
}
%>